package com.sky.mapper;


import com.github.pagehelper.Page;
import com.sky.annotation.AutoFill;
import com.sky.dto.DishPageQueryDTO;
import com.sky.entity.Dish;
import com.sky.enumeration.OperationType;
import com.sky.vo.DishVO;
import org.apache.ibatis.annotations.*;

@Mapper
public interface DishMapper {
    //更具id获取菜品信息
    @Select("select * from dish where id = #{id}")
    Dish getById(Long id);

    @Delete("delete from dish where id = #{id}")
    void deleteById(@Param("id") Long id);

    /*
    套餐分页查询
     */
    Page<DishVO> pageQuery(DishPageQueryDTO dishPageQueryDTO);

    /*
    新增菜品
     */
    @AutoFill(OperationType.INSERT)
    void insert(Dish dish);

    /*
    更新菜品基本数据
     */
    @AutoFill(value = OperationType.UPDATE)
    void update(Dish dish);

    /*
    更新状态
     */
    @Update("update dish set status = #{status} where id = #{id}")
    void updateStatus(Integer status, Long id);
}
